Dynomotion

Group: DynoMotion Message: 7834 From: babinda01 Date: 7/2/2013
Subject: Mach3 disable limits
Hi Guys
I have built a router, and am now using Mach3 and Kflop/Kanalog boards.
I have set up limits on the gantry, at either end of the tables extents (width wise), but I have a rack style toolchanger set up at the extreme left hand end of the gantries travel, which means I need to travel past the limit switch to perform a toolchange. I need to have the limits where they are, so as to stop the Z axis from crashing into the tool rack during normal operation
.
My thought is that in my M6start macro, I add the following functionality.
1. Move to a position in X a few mm off my limit. ie G53 X???
2. Somehow disable my limits on the kflop boards,
3. move to my X toolchange position, and change tools
4. Move back to within my tables working area.
5. Re-enable limits on the kflop board.

Can someone please explain how to achieve the disabling and re-enabling of limits from within my mach3 macro.
I am pretty sure I would do this within my NotifyMach.c, but not sure how.
Or is there a better way of doing what I want?

Thanks
Andrew
Group: DynoMotion Message: 7836 From: tmday7 Date: 7/2/2013
Subject: Re: Mach3 disable limits
Hi Andrew,
My Home C program does similar to what you want. When i reference each axis the Limit switch is disabled to keep from triggering a limit fault then re-enable after. Here is where my C program is...
http://tech.groups.yahoo.com/group/DynoMotion/files/KFLOP%20MillDrill/C%20Programs/After%20Interface/
Its named HomeEncoderMach3(Version3,1).c . If you look at comments after each// it will help a lot to see what is going on.
I dont know much about C programming, Tom did all the hard work. Anything i do to C programs is Copy and Paste from examples. :)

HTH,
Troy

--- In DynoMotion@yahoogroups.com, andrew@... wrote:
>
> Hi Guys
> I have built a router, and am now using Mach3 and Kflop/Kanalog boards.
> I have set up limits on the gantry, at either end of the tables extents (width wise), but I have a rack style toolchanger set up at the extreme left hand end of the gantries travel, which means I need to travel past the limit switch to perform a toolchange. I need to have the limits where they are, so as to stop the Z axis from crashing into the tool rack during normal operation
> .
> My thought is that in my M6start macro, I add the following functionality.
> 1. Move to a position in X a few mm off my limit. ie G53 X???
> 2. Somehow disable my limits on the kflop boards,
> 3. move to my X toolchange position, and change tools
> 4. Move back to within my tables working area.
> 5. Re-enable limits on the kflop board.
>
> Can someone please explain how to achieve the disabling and re-enabling of limits from within my mach3 macro.
> I am pretty sure I would do this within my NotifyMach.c, but not sure how.
> Or is there a better way of doing what I want?
>
> Thanks
> Andrew
>
Group: DynoMotion Message: 7837 From: tapiolarikka Date: 7/2/2013
Subject: Re: Mach3 disable limits
Hi Andrew,

One way of doing this is:

- Put an endless loop at the end of the init file
- in the loop put code that checks for a virtual bit state
true-> enable limits/false->disable limits (or opposite, just
remember which it is)
- In mach screen you can add:
bitmap led "limits disabled" and set it to blink when
bit is 0 so that you know the state of the limits.
- create a macro to control the state of this bit from g-code

I use the above and a bit more in my homing. when I hit axis ref button a green "Limits Active" button starts blinking in red/yellow saying "Limits Inactive/Activate Limits". When homing finishes it turns back green.
This way the limit state is controllable from screen and macros

Rgds,
Tapio



--- In DynoMotion@yahoogroups.com, "tmday7" <tmday88@...> wrote:
>
> Hi Andrew,
> My Home C program does similar to what you want. When i reference each axis the Limit switch is disabled to keep from triggering a limit fault then re-enable after. Here is where my C program is...
> http://tech.groups.yahoo.com/group/DynoMotion/files/KFLOP%20MillDrill/C%20Programs/After%20Interface/
> Its named HomeEncoderMach3(Version3,1).c . If you look at comments after each// it will help a lot to see what is going on.
> I dont know much about C programming, Tom did all the hard work. Anything i do to C programs is Copy and Paste from examples. :)
>
> HTH,
> Troy
>
> --- In DynoMotion@yahoogroups.com, andrew@ wrote:
> >
> > Hi Guys
> > I have built a router, and am now using Mach3 and Kflop/Kanalog boards.
> > I have set up limits on the gantry, at either end of the tables extents (width wise), but I have a rack style toolchanger set up at the extreme left hand end of the gantries travel, which means I need to travel past the limit switch to perform a toolchange. I need to have the limits where they are, so as to stop the Z axis from crashing into the tool rack during normal operation
> > .
> > My thought is that in my M6start macro, I add the following functionality.
> > 1. Move to a position in X a few mm off my limit. ie G53 X???
> > 2. Somehow disable my limits on the kflop boards,
> > 3. move to my X toolchange position, and change tools
> > 4. Move back to within my tables working area.
> > 5. Re-enable limits on the kflop board.
> >
> > Can someone please explain how to achieve the disabling and re-enabling of limits from within my mach3 macro.
> > I am pretty sure I would do this within my NotifyMach.c, but not sure how.
> > Or is there a better way of doing what I want?
> >
> > Thanks
> > Andrew
> >
>
Group: DynoMotion Message: 7838 From: Tom Kerekes Date: 7/2/2013
Subject: Re: Mach3 disable limits
Hi Andrew,

I like Taio's method.  But you can also use Troy's method:


The basic idea is that you can disable X limits by setting the Limit Switch Options to zero using C code of:

     ch0->LimitSwitchOptions=0;

To re-enable limits set them back to whatever is configured in your Init.c program.  Here is an example

     ch0->LimitSwitchOptions=0x606000f;



To execute any C code from Mach3 you can put the C code into the Notify.c program with a condition that it executes when a specific message number is sent to the Notify.c program.  Here we choose message 10401 to turn Limits on and message 10402 to turn Limits off


 if (msg==10401)
 {
     // User wants to enable Limit Switch Options on X
     ch0->LimitSwitchOptions=0x606000f;
 }

 
if (msg==10402)
 {
     // User wants to disable Limit Switch Options on X
     ch0->LimitSwitchOptions=0;
 }


After that you can easily execute the code from a Mach3 Macro or Mach3 Button by adding Basic code to:

NotifyPlugins(10401)

or

NotifyPlugins(10402)



HTH
Regards
TK